package com.igoal.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.igoal.common.SessionConstants;

@Controller
@RequestMapping("/logout.html")
public class LogoutController {
	@RequestMapping(method = RequestMethod.GET)
	public String logout(HttpServletRequest request,
			HttpServletResponse response) {
		HttpSession session = request.getSession();
		if (session != null) {
			session.removeAttribute(SessionConstants.USER_SESSION);
		}

		return "redirect:index.html";
	}
}
